#include <unistd.h>

#include <sys/types.h>

#include <stdio.h>



int main ()

{

        pid_t pid;  //fork函数返回值

        pid=fork(); //通过fork函数给进程id赋值



        if (pid < 0)

                printf("error in fork!");

        else if (pid == 0)

                printf("i am the child process, my process id is %d\n",getpid());

        else

                printf("i am the parent process, my process id is %d\n",getpid());

        return 0;

}